﻿Imports System.Net.Sockets
Imports System
Imports System.Text
Imports System.Threading
Imports Microsoft.VisualBasic
Imports System.Net
Public Class MainForm
    Public clients As New Dictionary(Of String, Object)
    Public Worlds As New Collection

#Region "Definitions"

    Public dataready As Boolean
    Public IAC_COMMAND = CByte(255)
    Public IAC_DO = CByte(253)
    Public IAC_DONT = CByte(254)
    Public IAC_WILL = CByte(251)
    Public IAC_WONT = CByte(252)
    Public IAC_SB = CByte(250)
    Public IAC_GA = CByte(249)
    Public IAC_ERASELINE = CByte(248)
    Public IAC_ERASECHAR = CByte(247)
    Public IAC_AYT = CByte(246)
    Public IAC_ABORT = CByte(245)
    Public IAC_INTERRUPT = CByte(244)
    Public IAC_BREAK = CByte(243)
    Public IAC_DATA = CByte(242)
    Public IAC_NOP = CByte(241)
    Public IAC_SE = CByte(240)
    Public IAC_ECHO = CByte(1)
    Public IAC_SGA = CByte(3)
    Public IAC_STATUS = CByte(5)
    Public IAC_TMRK = CByte(6)
    Public IAC_TERM = CByte(24)
    Public IAC_EOR = CByte(25)
    Public IAC_NAWS = CByte(31)
    Public IAC_TSPEED = CByte(32)
    Public IAC_FLOW = CByte(33)
    Public IAC_LINE = CByte(34)
    Public IAC_XDISP = CByte(35)
    Public IAC_ENV = CByte(36)
    Public IAC_NEWENV = CByte(39)
    Public IAC_CHARSET = CByte(42)
    Public IAC_STARTTLS = CByte(46)
    Public IAC_MSSP = CByte(70)
    Public IAC_MCP = CByte(86)
    Public IAC_MSP = CByte(90)
    Public IAC_MXP = CByte(91)
    Public CSI_CUU = CByte(65)
    Public CSI_CUD = CByte(66)
    Public CSI_CUF = CByte(67)
    Public CSI_CUB = CByte(68)
    Public CSI_CNL = CByte(69)
    Public CSI_CPL = CByte(70)
    Public CSI_CHA = CByte(71)
    Public CSI_CUP = CByte(72)
    Public CSI_ED = CByte(73)
    Public CSI_EL = CByte(74)
    Public CSI_SU = CByte(75)
    Public CSI_SD = CByte(76)
    Public CSI_HVP = CByte(102)
    Public CSI_SGR = CByte(109)
    Public ANSI_RESET = 0
    Public ANSI_BRIGHT = 1
    Public ANSI_FAINT = 2
    Public ANSI_ITALIC = 3
    Public ANSI_UNDERLINE = 4
    Public ANSI_BLINKSLOW = 5
    Public ANSI_BLINKRAPID = 6
    Public ANSI_INVERSE = 7
    Public ANSI_CONCEAL = 8
    Public ANSI_CROSSOUT = 9
    Public ANSI_PRIMARY = 10
    Public ANSI_BOLDOFF = 21
    Public ANSI_NORMAL = 22
    Public ANSI_BLINKOFF = 25
    Public ANSI_REVEAL = 28
    Public ANSI_BLACK = 30
    Public ANSI_RED = 31
    Public ANSI_GREEN = 32
    Public ANSI_YELLOW = 33
    Public ANSI_BLUE = 34
    Public ANSI_MAGENTA = 35
    Public ANSI_CYAN = 36
    Public ANSI_WHITE = 37
    Public ANSI_256COL = 38
    Public ANSI_DEFAULTBG = 39
    Public ANSI_BGBLACK = 40
    Public ANSI_BGRED = 41
    Public ANSI_BGGREEN = 42
    Public ANSI_BGYELLOW = 43
    Public ANSI_BGBLUE = 44
    Public ANSI_BGMAGENTA = 45
    Public ANSI_BGCYAN = 46
    Public ANSI_BGWHITE = 47
    Public ANSI_256COLBG = 48
    Public STATE_NORMAL = 1
    Public STATE_IAC = 2
    Public STATE_IAC_SB = 3
    Public STATE_CSI = 4
    Public BSMState As Int16
    Public useUTF8 As Boolean
#End Region





    Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)

    End Sub

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub QuickConnectButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        QuickConnect.Show()
    End Sub

    Public Sub dolog(ByVal logstring As String)

    End Sub


    Private Sub SplitContainer2_Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)

    End Sub

    Private Sub QuickConnectButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuickConnectButton.Click

        QuickConnect.Show()


    End Sub

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        OptionsForm.Show()

    End Sub

    Private Sub TabControl1_SelectedChanged(ByVal sender As Object, ByVal e As TabControlEventArgs) Handles TabControl1.Selected
        'Should make this focus on the input text box of the newly selected tab.
        Dim ctrls() As Control
        Dim mytab As TabPage
        mytab = e.TabPage
        ctrls = mytab.Controls.Find("worldinput", True)
        For Each ctrl In ctrls
            ctrl.Focus()
        Next



    End Sub

    Private Sub GlobalPreferencesToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles GlobalPreferencesToolStripMenuItem.Click
        OptionsForm.Show()

    End Sub

    Private Sub NewConnectionToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NewConnectionToolStripMenuItem.Click
        WorldEdit.Show()

    End Sub

    Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
        If (ToolStripButton3.CheckState = False) Then
            ToolStripButton3.Checked = True
            WorldClient.DEBUG_ENABLED = True

        Else
            ToolStripButton3.Checked = False
            WorldClient.DEBUG_ENABLED = False
        End If

    End Sub

    Private Sub ToolStripMenuItem27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem27.Click

    End Sub

    Private Sub ToolStripButton4_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton4.Click

        MsgBox("I was called by " + TabControl1.SelectedTab.Parent.ToString)


    End Sub
End Class
